<?php

	function smarty_block_transport_types($params, $content, &$smarty, &$repeat)
    {
		global $db, $config;

		$l = count($smarty->_tag_stack);
		if(empty($params['name'])) $params['name'] = "transport_types";

		if(empty($smarty->blockvars[$l]))
        {
			$sqlstr = "select * from {$config->db_prefix}transport_type";

			$limit = empty($params['limit'])?9999:$params['limit'];
			$page = empty($params['page'])?1:$params['page'];
			$pager = new pager($limit, $page);
			$smarty->blockvars[$l] = $pager->execute($db, $sqlstr);
			//var_dump($smarty->blockvars);exit;
			if(!$smarty->blockvars[$l]) return $repeat = false;
			if(!empty($params['pager'])) $smarty->assign($params['pager'], $pager);
		}

		if(list($key, $item) = each($smarty->blockvars[$l])) {
			$repeat = true;
			$smarty->assign($params['name'], $item);
		}
		else
		{
			$repeat = false;
			reset($smarty->blockvars[$l]);
		}

		if(!is_null($content)) print $content;
		if(!$repeat) $smarty->blockvars[$l] = array();
	}
